/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package org.vale.entity;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Embeddable;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

/**
 *
 * @author Gabriel Bran gbran.u@gmail.com
 */
@Embeddable
public class ContactSitePK implements Serializable {
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 15)
    @Column(name = "idsite")
    private String idsite;
    @Basic(optional = false)
    @NotNull
    @Column(name = "idcontact")
    private int idcontact;

    public ContactSitePK() {
    }

    public ContactSitePK(String idsite, int idcontact) {
        this.idsite = idsite;
        this.idcontact = idcontact;
    }

    public String getIdsite() {
        return idsite;
    }

    public void setIdsite(String idsite) {
        this.idsite = idsite;
    }

    public int getIdcontact() {
        return idcontact;
    }

    public void setIdcontact(int idcontact) {
        this.idcontact = idcontact;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idsite != null ? idsite.hashCode() : 0);
        hash += (int) idcontact;
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof ContactSitePK)) {
            return false;
        }
        ContactSitePK other = (ContactSitePK) object;
        if ((this.idsite == null && other.idsite != null) || (this.idsite != null && !this.idsite.equals(other.idsite))) {
            return false;
        }
        if (this.idcontact != other.idcontact) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "org.vale.entity.ContactSitePK[ idsite=" + idsite + ", idcontact=" + idcontact + " ]";
    }
    
}
